import {Getvideotaglist,Getalistofallvideos,Getvideosundervideotagscategories} from '@/api/api.js'
const state={
//获取视频标签列表
videotaglist:[],
//获取全部视频列表
 talistofallvideos:[],
 //获取视频标签/分类下的视频
 videosundervideotagscategories:[]
};
const mutations={
//获取视频标签列表
GETVIDEOTAGLIST(state,videotaglist){
  state.videotaglist = videotaglist
},
    //获取全部视频列表
  GETTALISTOFALLVIDEOS(state,talistofallvideos){
    state.talistofallvideos = talistofallvideos
  },
  //获取视频标签/分类下的视频
  GETVIDEOSUNDERVIDEOTAGSCATEGORIES(state,videosundervideotagscategories){
    state.videosundervideotagscategories = videosundervideotagscategories
  }
};
const actions ={
  //获取视频标签列表
   async getGetvideotaglist({commit}){
    let request = await Getvideotaglist()
    if(request.data.code==200){
      commit('GETVIDEOTAGLIST',request.data.data)
    }
    },
    //获取全部视频列表
   async getGetalistofallvideos({commit},{offset}){
    let request = await Getalistofallvideos(offset)
    console.log(request);
    if(request.data.code==200){
      commit('GETTALISTOFALLVIDEOS',request.data.datas)
    }
    },
    //获取视频标签/分类下的视频
   async getGetvideosundervideotagscategories({commit},{id,offset}){
    let request = await Getvideosundervideotagscategories({id,offset})
    console.log(request);
    if(request.data.code==200){
      commit('GETVIDEOSUNDERVIDEOTAGSCATEGORIES',request.data.datas)
    }
    }
};
const getter ={

};
export default {
  state,
  mutations,
  actions,
  getter
}